class User < ActiveRecord::Base

  attr_accessible :name, :email, :password, :id, :username
  attr_accessor :password_confirmation, :id

  email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

  validates :name,  :presence => true,
                    :length => {:minimum => 4, :maximum => 30}
  validates :email, :presence => true,
                    :format => {:with => email_regex},
                    :uniqueness => true
  validates :password, :presence => true,
                       :length => {:minimum => 6}
  validates :username, :presence => true,
                       :uniqueness => true


end
